package com.sqx.modules.pushMsgType.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.pushMsgType.entity.PushMsgType;
import com.sqx.modules.pushMsgType.service.PushMsgTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 工作提醒-管理端
 * @author wuChang
 * @since 2024-03-28
 */
@RestController
@Api(value = "工作提醒-管理端", tags = {"工作提醒-管理端"})
@RequestMapping("/admin/pushMsgType/")
public class AdminPushMsgTypeController {
    @Autowired
    private PushMsgTypeService pushMsgTypeService;

    /**
     * 新增或修改工作提醒
     *@param pushMsgType 工作提醒
     */
    @ApiOperation("新增或修改工作提醒")
    @PostMapping(value = "savePushMsgType")
    public Result savePushMsgType(PushMsgType pushMsgType) {
        return pushMsgTypeService.savePushMsgType(pushMsgType);
    }

    /**
     * 获取工作提醒列表
     * @param pushMsgType 工作提醒
     */
    @ApiOperation("获取工作提醒列表")
    @GetMapping(value = "getPushMsgTypeList")
    public Result getPushMsgTypeList(Integer page, Integer limit, PushMsgType pushMsgType) {

        return Result.success().put("data", pushMsgTypeService.getPushMsgTypeList(page, limit, pushMsgType));
    }

    /**
     * 删除工作提醒
     *@param typeId 工作提醒id
     */
    @ApiOperation("删除工作提醒")
    @PostMapping(value = "deletePushMsgTypeById")
    public Result deletePushMsgTypeById(Long typeId) {

        return pushMsgTypeService.removeById(typeId) ? Result.success() : Result.error();
    }


    /**
     * 获取工作提醒详情
     *@param typeId 工作提醒id
     */
    @ApiOperation("获取工作提醒详情")
    @GetMapping(value = "getPushMsgTypeById")
    public Result getPushMsgTypeById(Long typeId) {
        return Result.success().put("data", pushMsgTypeService.getById(typeId));
    }

}